home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / exec / releasesemaphorelist.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-12  |  1.5 KB  |  76 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: releasesemaphorelist.c,v 1.4 1996/08/13 13:56:06 digulla Exp $
  4.     $Log: releasesemaphorelist.c,v $
  5.     Revision 1.4  1996/08/13 13:56:06  digulla
  6.     Replaced __AROS_LA by __AROS_LHA
  7.     Replaced some __AROS_LH*I by __AROS_LH*
  8.     Sorted and added includes
  9.  
  10.     Revision 1.3  1996/08/01 17:41:16  digulla
  11.     Added standard header for all files
  12.  
  13.     Desc:
  14.     Lang: english
  15. */
  16. #include "exec_intern.h"
  17. #include "semaphores.h"
  18.  
  19. /*****************************************************************************
  20.  
  21.     NAME */
  22.     #include <exec/semaphores.h>
  23.     #include <clib/exec_protos.h>
  24.  
  25.     __AROS_LH1(void, ReleaseSemaphoreList,
  26.  
  27. /*  SYNOPSIS */
  28.     __AROS_LHA(struct List *, sigSem, A0),
  29.  
  30. /*  LOCATION */
  31.     struct ExecBase *, SysBase, 98, Exec)
  32.  
  33. /*  FUNCTION
  34.     This function releases all semaphores in the list at once.
  35.  
  36.     INPUTS
  37.     sigSem - pointer to list full of semaphores
  38.  
  39.     RESULT
  40.  
  41.     NOTES
  42.  
  43.     EXAMPLE
  44.  
  45.     BUGS
  46.  
  47.     SEE ALSO
  48.  
  49.     INTERNALS
  50.  
  51.     HISTORY
  52.  
  53. *****************************************************************************/
  54. {
  55.     __AROS_FUNC_INIT
  56.     struct Node *n;
  57.  
  58.     /*
  59.     There's no arbitration needed - the first semaphore in the list
  60.     arbitrates for the full list.
  61.     Get first element in the list.
  62.     */
  63.     n=sigSem->lh_Head;
  64.  
  65.     /* And follow it. */
  66.     while(n->ln_Succ!=NULL)
  67.     {
  68.     /* Free the semaphore */
  69.     ObtainSemaphore((struct SignalSemaphore *)n);
  70.  
  71.     /* Get next element */
  72.     n=n->ln_Succ;
  73.     }
  74.     __AROS_FUNC_EXIT
  75. } /* ReleaseSemaphoreList */
  76.